
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../demo.css">
	<script type="text/javascript" src="../jquery.min.js"></script>
	<script type="text/javascript" src="../jquery.easyui.min.js"></script>
    <style>
		.icon-trace {background: url('../img/_0003_导出列表.png') no-repeat center center;}
		/*.icon-playback {background: url('../img/_0009_详细.png') no-repeat center center;}
		.icon-detail{background: url('../img/_0004_导出详细.png') no-repeat center center;}*/
	</style>
</head>
<body >	
      
	 <div style="width:1200px;height:500px">
        <table id="dg" class="easyui-datagrid" title="" style="width:1200px;height:500px"
        data-options="rownumbers:true,singleSelect:true,selectOnCheck:false,checkOnSelect:false,pagination:true,toolbar:toolbar">
		<thead>
			<tr>
				<th data-options="field:'licenseNumber',width:150">车牌号</th>
				<th data-options="field:'customer',width:150">客户名称</th>
				<th data-options="field:'ModelName',width:150">车型</th>
			    <th data-options="field:'d_esn',width:150,hidden:false">终端号</th>
				<th data-options="field:'title',width:150,hidden:false">报警类型</th>
				<th data-options="field:'content',width:150,hidden:false">报警内容</th>
				<th data-options="field:'createTime',width:150,hidden:false">报警时间</th>
				<th data-options="field:'dealTime',width:150,hidden:false">处理时间</th>
				<th data-options="field:'deviceID',width:0,hidden:true">deviceID</th>
			</tr>
		</thead>
	</table>
	</div>
	<script type="text/javascript">
	var glob_rows;
	var  glob_startDate;
	var  glob_stopDate;
	var  glob_deviceIDs;
	var  glob_deviceID;
	var  glob_speed;
	var  glob_alertTypes;
	var toolbar = [{
		text:'excel导出',
		iconCls:'icon-trace',
		handler:function(){	
			  var url='../smarty/demo/resoveledAlert_excel.php?startDate='+glob_startDate+'&stopDate='+glob_stopDate+'&devices='+glob_deviceIDs+'&alertTypes='+glob_alertTypes;
		//        alert(url);
		         window.open(url,"_blank");
			    }
				
	}
	];
	

  function dailySearch(deviceArr,startDate,stopDate,comValues){
		 glob_startDate=startDate;
		 glob_stopDate=stopDate;
		 deviceIDs=deviceArr.join(",");
		 glob_deviceIDs=deviceIDs;
		 if(comValues.length>0){
			 alertTypes=comValues.join(",");
		 }
		 else{
			 alertTypes='0,1,2,3,4,5,6,7';
		 }
	//	 alert("alertTypes:"+alertTypes);
		 glob_alertTypes=alertTypes;
		 url='../service/resoveledAlertAPI.php?opType=0&startDate='+startDate+'&stopDate='+stopDate+'&alertTypes='+alertTypes+'&devices='+deviceIDs;
	//	 alert(url);
		 $('#dg').datagrid({loadFilter:pagerFilter}).datagrid({   
			 url:url
					 }
		);  
	  }
  
  
  function pagerFilter(data){
		if (typeof data.length == 'number' && typeof data.splice == 'function'){	// is array
			data = {
				total: data.length,
				rows: data
			}
		}
		var dg = $(this);
		var opts = dg.datagrid('options');
		var pager = dg.datagrid('getPager');
		pager.pagination({
			onSelectPage:function(pageNum, pageSize){
				opts.pageNumber = pageNum;
				opts.pageSize = pageSize;
				pager.pagination('refresh',{
					pageNumber:pageNum,
					pageSize:pageSize
				});
				dg.datagrid('loadData',data);
			}
		});
		if (!data.originalRows){
			data.originalRows = (data.rows);
		}
		var start = (opts.pageNumber-1)*parseInt(opts.pageSize);
		var end = start + parseInt(opts.pageSize);
		data.rows = (data.originalRows.slice(start, end));
		return data;
	}
	</script>
		</body>
</html>